Component({
    properties: {
        address: {
            type: Object,
            value: {},
            observer: function(s) {
                var e = s = s || {}, t = e.address, a = e.addressdetail, d = e.addresslat, r = e.addresslng;
                this.setData({
                    form: {
                        address: t,
                        addressdetail: a,
                        addresslat: d,
                        addresslng: r
                    }
                });
            }
        }
    },
    data: {
        form: {},
        addressFocus: !1
    },
    ready: function() {
        this.data.form.addressdetail && this.setData({
            addressFocus: !0
        });
    },
    methods: {
        onInput: function(s) {
            var e = s.detail.value;
            this.setData({
                "form.addressdetail": e
            }), this.$eventEmit();
        },
        onBlur: function() {
            this.setData({
                addressFocus: !1
            });
        },
        clearAddressInfo: function() {
            this.setData({
                form: {
                    address: "",
                    addressdetail: "",
                    addresslat: 0,
                    addresslng: 0
                }
            }), this.$eventEmit();
        },
        chooseAddress: function() {
            var e = this;
            wx.facility("chooseLocation", {
                success: function(s) {
                    e.setData({
                        form: {
                            address: s.address,
                            addressdetail: s.name,
                            addresslat: s.latitude,
                            addresslng: s.longitude
                        },
                        addressFocus: !0
                    }), e.$eventEmit();
                }
            });
        },
        $eventEmit: function() {
            var s = this;
            clearTimeout(this.timer), this.timer = setTimeout(function() {
                s.triggerEvent("success", s.data.form, {});
            }, 200);
        }
    }
});